package operation.impl;

import book.Book;
import book.BookList;
import operation.IOperation;

/**
 * 查询书籍
 */
public class FindOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("当前进行的是查询书籍操作~");
        System.out.print("请输入书籍名称：");
        String bookName= scanner.next();
        if(bookList.contains(bookName)){
            Book book=bookList.currentBook(bookName);
            System.out.println("bookName='" + book.getBookName() + '\'' +
                    ", author='" + book.getAuthor() + '\'' +
                    ", prize=" + book.getPrize() +
                    ", type='" + book.getType() + '\'' +
                    ", isBorrowed=" + book.isBorrowed());
        }else{
            System.out.println("无该书籍~");
            return;
        }
    }
}
